package com.deram.ctin.serv.system.api.impl;

import com.deram.ctin.serv.system.api.SystemUserApi;
import com.deram.ctin.serv.system.entity.SystemUser;
import com.deram.ctin.serv.system.service.SystemUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by xhw on 2017/09/13.
 */

@RestController
public class SystemUserApiImpl implements SystemUserApi {

    @Autowired
    private SystemUserService systemUserService;

    @Override
    public SystemUser find(@RequestParam("id") Long id) {
        return systemUserService.find(id);
    }

    @Override
    public SystemUser findByUsername(@RequestParam("username") String username) {
        return systemUserService.findByUsername(username);
    }

    @Override
    public SystemUser create(@RequestBody SystemUser param) {
        return systemUserService.create(param);
    }

    @Override
    public void updatePassword(@RequestParam("id") Long id, @RequestParam("newPassword") String newPassword) {
        systemUserService.updatePassword(id,newPassword);
    }

    @Override
    public void delete(@RequestParam("id") Long id) {
        systemUserService.delete(id);
    }
}
